package com.dunke.core.common;

import java.util.List;

public class ResultPage<T> {

    /**
     * 当前页
     */
    private int page;

    /**
     * 当前页数据量
     */
    private int size;

    /**
     * 总数据量
     */
    private int total;

    /**
     * 是否可加载下一页
     */
    private boolean isLoad = true;

    /**
     * 数据
     */
    private List<T> data;

    public ResultPage(List<T> data, int page, int size) {
        this.data = data;
        this.page = page;
        this.size = size;
    }

    public ResultPage(List<T> data, int page, int size, boolean load) {
        this.data = data;
        this.page = page;
        this.size = size;
        this.isLoad = load;
    }

    public ResultPage(List<T> data, int page, int size, int total, boolean load) {
        this.data = data;
        this.page = page;
        this.size = size;
        this.total = total;
        this.isLoad = load;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public boolean isLoad() {
        return isLoad;
    }

    public void setLoad(boolean load) {
        this.isLoad = load;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "ResultPage{" +
                "page=" + page +
                ", size=" + size +
                ", total=" + total +
                ", isLoad=" + isLoad +
                ", data=" + data +
                '}';
    }
}
